Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AMD] Implement RepOrder for AMD MMA layouts and change kMajor notation to kMinor #5126

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

oplavsic
Copy link
Contributor

@oplavsic oplavsic commented Nov 12, 2024

Implement RepOrder methods for MFMA and WMMA layouts. Both layouts have row major rep layout. Also,
isTranspose flag in MFMA layout does not affect RepOrder, meaning RepOrder is row major in both cases.
Also, this commit changes kMajor to kMinor notation. For a long time, kMajor is mis-used to indicate K is the fastest changing dimension. If we follow the same convention of row-major, it actually means elements on the same row are contiguous in memory.

@zhanglx13
Copy link
Collaborator

Thank you @oplavsic
Since you are here, can you also change kMajor to kMinor? For a long time, kMajor is mis-used to indicate K is the fastest changing dimension. If we follow the same convention of row-major, it actually means elements on the same row are contiguous in memory. So k-major means elements of the same k index are contiguous in memory, which is not what we mean here.

@zhanglx13
Copy link
Collaborator

Also AMD sharedToDotOperand:

bool isKMajor(llvm::ArrayRef<unsigned> order, int opIdx) {

@oplavsic
Copy link
Contributor Author

Also AMD sharedToDotOperand:

bool isKMajor(llvm::ArrayRef<unsigned> order, int opIdx) {

Done!

Copy link
Collaborator

@zhanglx13 zhanglx13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
@oplavsic Can you also include the fix of kmajor -> kminor in the PR title and description?

@oplavsic oplavsic changed the title [AMD] Implement RepOrder for AMD MMA layouts [AMD] Implement RepOrder for AMD MMA layouts and change kMajor notation to kMinor Nov 13, 2024
@lezcano
Copy link
Contributor

lezcano commented Nov 14, 2024

So k-major means elements of the same k index are contiguous in memory, which is not what we mean here.

I see your point, but perhaps kMajor is just ambiguous. The way I thought about this is "as you traverse the K dimension, it's contiguous". In the same way that rowMajor means that "as you traverse a row, it's contiguous". What about using kContig?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants